package com.shop.controller;

import com.shop.api.MemberService;
import com.shop.base.BaseResponse;
import com.shop.member.outputtDTO.UserMessageDTO;
import com.shop.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LB
 * @version 1.0
 * @date 2020/9/7 12:45
 */
@RestController
public class MemberController  {

    @Autowired
    private UserService userService;
    /**
     *
     * @param id
     * @return
     */

    public BaseResponse<JSONObject> updateUserMessage(String id) {
        return null;

    }

    /**
     *
     * @param page
     * @param limit
     * @return
     */

    @GetMapping("/getAllUser")
    @ApiOperation("获取所有用户信息")
    public BaseResponse<List<UserMessageDTO>> getAllUser(@RequestParam("page")Integer page, @RequestParam("limit")Integer limit) {
        return userService.getAllUser(1,2);
    }

    /**
     *
     * @param id
     * @return
     */

    //删除用户
    @DeleteMapping("deleteUserByid")
    @ApiOperation("删除用户")
    public BaseResponse<JSONObject> deleteUserById(@RequestParam("id")String id) {
        return userService.deleteUserById(id);
    }
}
